/**
* 描述：侯选库
*/
<style lang="scss" scoped>
  @import 'src/styles/company/index';
</style>
<template>
  <div class="content">
    <div class="com-main-title">
      <span class="tit">侯选库</span>
      <div class="clear"></div>
    </div>
    <!--搜索条部分-->
    <div class="search-bar">
      <div class="oneImput fl wth160px">
        <el-input v-model="searchData.name" placeholder="名称" size="small"></el-input>
      </div>
      <div class="oneImput fr">
        <el-button type="primary" class="search-button fl" icon="search" @click="search" size="small">搜索</el-button>
        <div class="clear"></div>
      </div>
      <div class="clear"></div>
    </div>

    <!--table部分-->
    <div class="table-content">
      <el-table
        size="mini"
        :data="list"
        v-loading="loading"
        :element-loading-text="loadingText"
        highlight-current-row
        border
        style="width: 100%">
        <el-table-column
          prop="name"
          label="用户真实姓名"
          align="center"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          prop="phone"
          label="手机号"
          align="center"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          prop="sex"
          align="center"
          label="性别">
          <template slot-scope="scope">
            {{ scope.row.sex | sexType }}
          </template>
        </el-table-column>
        <el-table-column
          prop="job"
          align="center"
          show-overflow-tooltip
          width="180"
          label="工作职位">
        </el-table-column>
        <el-table-column
          prop="birth"
          align="center"
          show-overflow-tooltip
          label="生日">
        </el-table-column>
        <el-table-column
          prop="education"
          align="center"
          show-overflow-tooltip
          label="学历">
          <template slot-scope="scope">
            {{ scope.row.education | education }}
          </template>
        </el-table-column>
        <el-table-column
          prop="company"
          align="center"
          label="当前就职公司"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column label="操作" align="center" width="100px" fixed="right" class="xxx">
          <template slot-scope="scope">
            <a class="cz" @click="queryDetail(scope.row.id)">查看</a>
            <a class="cz" @click="invitation(scope.row.jobId, scope.row.talentId)">邀请</a>
            <a class="cz" @click="invite(scope.row.id, 7, '拒绝')">拒绝</a>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <hy-page v-show="pageShow"
               :current-page="searchData.page"
               :page-size="searchData.limit"
               :total-element="totalElement"
               @current-change="currentChange"></hy-page>
    </div>
    <Modal v-model="infoShow" :mask-closable="false" style="min-width: 720px" class="jianLiDetail-modal noTopBottomBorder">
      <p slot="header" style="color:#000;text-align:center;font-weight: bold;font-size: 18px;">
        <span>简历查看</span>
      </p>
      <div class="jianLi-logo">
        <img :src="`/api/pub/image/${detailData.avatar}`" alt="简历">
      </div>
      <div class="jianLi-info">
        <p style="float: left">真实姓名：{{detailData.name}}</p>
        <p style="float: left;margin-left:100px;">性别：{{detailData.sex | sexType}}</p>
        <div class="clear"></div>
        <p>手机号：{{detailData.phone}}</p>
        <p>出生年月：{{detailData.birth}}</p>
        <p>当前就职公司：{{detailData.name}}</p>
        <p>最高学历：{{detailData.education | education}}</p>
        <p>工作职位：{{detailData.job}}</p>
        <p>主修专业：{{detailData.major}}</p>
        <p>毕业院校：{{detailData.school}}</p>
        <p>工作经验年限：{{detailData.workExperience | experience}}</p>
        <p>一句话简介：{{detailData.briefIntro}}</p>
      </div>
      <div class="clear"></div>
      <div class="title"><i class="iconCom"></i>工作经历</div>
      <div class="workOne">
        <p style="float:left;">2016/3-2018/11</p><p style="float:right;">武汉通信科技有限公司UI/平面设计师</p>
        <div class="clear"></div>
        <p>计算机软件<i>|</i><i>少于50人</i><i>|</i><i>民营公司</i><i>|</i><i>设计部</i></p>
        <p>工作描述：</p>
        <p class="workInfo">负责公司合作项目的软件界面设计、移动端产品界面设计、网...</p><span>展开 <i></i></span>
        <div class="clear"></div>
      </div>
      <div class="title"><i class="iconCom"></i>技能擅长</div>
      <div class="jiNeng">
        <div class="one">
          <p class="n">PS .AI</p>
          <div class="k"><span class="a" style="width:50%;">一般</span></div>
          <div class="clear"></div>
        </div>
        <div class="one">
          <p class="n">PS .AI</p>
          <div class="k"><span class="a" style="width:75%;">熟练</span></div>
          <div class="clear"></div>
        </div>
        <div class="one">
          <p class="n">PS .AI</p>
          <div class="k"><span class="a" style="width:100%;">精通</span></div>
          <div class="clear"></div>
        </div>
      </div>
      <div class="title"><i class="iconCom"></i>附加信息</div>
      <div class="other">
        <div class="upload">
          <i class="icon"></i><p>个人简历.word</p><a class="fr">下载</a>
          <div class="clear"></div>
          <i class="icon"></i><p>个人主页：</p><input type="text" placeholder="https://www.zcool.com.cn/u/15356517">
          <div class="clear"></div>
        </div>
      </div>
      <div slot="footer" style="width:100px;margin:0 auto;">
        <i-button plain round @click="infoShow = false" style="width:100px;">关闭</i-button>
      </div>
    </Modal>
  </div>
</template>
<script>
  import list from '@/js/mixins/list';
  import { queryList, queryCount, changeStatus, getById } from '@/service/company/resume/resumeMService';
  import hyHandler from '@/components/handler/handler';
  import { invite } from '@/service/company/jobInvitation/jobInvitationMService';
  export default {
    mixins: [list],
    components: {
      hyHandler
    },
    data () {
      return {
        loading: true,
        searchData: {},
        infoShow: false,
        detailData: {}
      };
    },
    methods: {
      async _getList () {
        this.loading = true;
        this.searchData.state = 3;
        let result = await queryList(this.searchData);
        let temp = await queryCount(this.searchData);
        if (!result.data.length) result.data = null;
        this.list = result.data || [];
        this.totalElement = temp.data || 0;
        this.loading = false;
      },
      // 加入候选
      invite (id, state, text) {
        this.$confirm(`是否${text}？`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          await changeStatus({id: id}, {status: state});
          this.$Notice.success({title: `已${text}`});
          this.currentChange();
        }).catch(() => {
        });
      },
      // 邀请
      async invitation (jobId, talentId) {
        this.$confirm(`确定邀请？`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          let params = {
            jobId: jobId,
            talentId: talentId
          };
          await invite(params);
          this.$Notice.success({title: `已邀请`});
          this.currentChange();
        }).catch(() => {
        });
      },
      // 点击查看预览
      async queryDetail (id) {
        this.infoShow = true;
        let result = await getById({id: id});
        this.detailData = result.data;
      }
    }
  };
</script>
